package com.srcptit.trainning.tranquangvinh.b1;

import java.util.Scanner;

public class Bai2 {
	public static void Dem(int a[],int n) {
		int b[]=new int [n];
		for(int i=0;i<n;i++){
			if(b[i] != -1)
				for(int j=i+1;j<n;j++){
					if(a[i]==a[j]){
						{
							b[i]++;
							b[j]=-1;
						}
					}
				}
		}
		for(int i=0;i<n;i++){
			if(b[i] != -1)
				System.out.println(a[i]+" xuat hien "+(b[i]+1)+" lan");
		}	
	}
	public static  void main(String[] args) {
		System.out.println("Nhap so nguyen n:");
		Scanner sc= new Scanner(System.in) ;
		int n;
		n=sc.nextInt();
		int a[]= new int [n];
		System.out.println("Nhap cac phan tu cua mang");
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		Dem(a,n);
	}
}
